package modele;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.Scanner;

import log.logger;

import com.google.gson.Gson;

public class IntervalleTemporellesFactory {
	public List<IntervalleTemporelle>intervalle;
	public long num;
	public static IntervalleTemporellesFactory Factory(){
		String js="";
		System.out.println(System.getProperty("user.dir"));
	    File file = new File("/Users/richard/Documents/perso/planningserver/tools-eclipse-conf/src/dataExemple/intervalleTemporelles.json");
	    try {
			Scanner sc = new Scanner(file);
			//js = sc.toString();
			while (sc.hasNext()){
				js = js + "\n" + sc.nextLine();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	   
	   IntervalleTemporellesFactory data = new Gson().fromJson(js, IntervalleTemporellesFactory.class);
	  // System.out.println(data.intervalle);
      /* JsonParser jsonParser = new JsonParser();
       JsonObject jo = (JsonObject)jsonParser.parse(js);
       JsonArray jsonArr = jo.getAsJsonArray("employes");
       */
	   
	  // logger.Infologg("[get liste IntervalleTemporelles]"+data.num + "  " + data.IntervalleTemporelle + "\n\n");
	    return data;
		
	}
}
